package com.uplift.mobile.user.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.uplift.mobile.user.dao.IReceiptsMapper;
import com.uplift.mobile.user.model.Receipts;
import com.uplift.mobile.user.service.IReceiptsService;
import com.uplift.sec.SecurityContext;

@Service
@Transactional
public class ReceiptsServiceImpl implements IReceiptsService {

	@Autowired
	private IReceiptsMapper receiptsMapper;

	@Override
	public List<Map<String, Object>> queryReceipts(Receipts receipts) {
		PageHelper.startPage(receipts.getPage(), receipts.getPageSize());
		receipts.setCustomerId(SecurityContext.getUserId());
		return this.receiptsMapper.selectReceipts(receipts);
	}

	@Override
	public Map<String, Object> queryReceiptsTotal(Receipts receipts) {
		receipts.setCustomerId(SecurityContext.getUserId());
		return this.receiptsMapper.selectReceiptsTotal(receipts);
	}

	@Override
	public Map<String, Object> queryReceiptsTotalNoFormat(Receipts receipts) {
		receipts.setCustomerId(SecurityContext.getUserId());
		return this.receiptsMapper.selectReceiptsNoFormat(receipts);
	}

}
